package com.yingside.collection.game;
import java.util.ArrayList;
import java.util.List;

public class Store {

	private List<Weapon> weapons;
	private List<Armor> armors;
	private List<Shoes> shoes;
	private List<Shield> shields;

	public Store(){
		initWeapons();
	}

	public void sell(Hero h, Weapon w){
		if(h.getOwnMoney() < w.getPrice()){
			System.err.println("\t"+h.getName() + ",你是穷逼,还想买武器?滚");
		}
		else if(w.getNum() == 0){
			System.err.println("\t武器库存不足...不能购买....");
		}
		else{
			//武器的库存-1
			w.setNum(w.getNum() - 1);

			//英雄的金钱减少
			h.setOwnMoney(h.getOwnMoney() - w.getPrice());

			//将买到的武器放入到英雄的背包中
			h.getWeaponBag().add(w);
			System.out.println("\n\t购买武器成功!\n");
		}
	}

	public void sell(Hero h, Armor a){

	}

	public void sell(Hero h, Shoes s){

	}


	public void initWeapons(){
		weapons = new ArrayList<Weapon>();
		Weapon w1 = new Weapon();
		w1.setName("多兰之剑");
		w1.setAttack(7);
		w1.setNum(10);
		w1.setPrice(400);
		weapons.add(w1);

		Weapon w2 = new Weapon();
		w2.setName("暴风大剑");
		w2.setAttack(40);
		w2.setNum(5);
		w2.setPrice(1300);
		weapons.add(w2);

		Weapon w3 = new Weapon();
		w3.setName("无尽之刃");
		w3.setAttack(80);
		w3.setNum(2);
		w3.setPrice(3800);
		weapons.add(w3);

		Weapon w4 = new Weapon();
		w4.setName("霜之哀伤");
		w4.setAttack(200);
		w4.setNum(1);
		w4.setPrice(14000);
		weapons.add(w4);

	}


	public List<Weapon> getWeapons() {
		return weapons;
	}
	public void setWeapons(List<Weapon> weapons) {
		this.weapons = weapons;
	}
	public List<Armor> getArmors() {
		return armors;
	}
	public void setArmors(List<Armor> armors) {
		this.armors = armors;
	}
	public List<Shoes> getShoes() {
		return shoes;
	}
	public void setShoes(List<Shoes> shoes) {
		this.shoes = shoes;
	}
	public List<Shield> getShields() {
		return shields;
	}
	public void setShields(List<Shield> shields) {
		this.shields = shields;
	}



}

